import Vue from 'vue'
import Vuex from 'vuex'
import createPersiste from 'vue-savedata'
import * as actions from './actions'
import {SET_BUCKET_DOMAIN,SET_BUCKET_DOMAIN_TOKEN,SET_DISTRICT_LIST} from './actionTypes';
Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		permissionList: [],
		operationList: [], //二级对应的三级操作权限列表
		imgDomain: 'https://zy-cdn.gymooit.cn/', // 图片域名地址
		bucket_domain_token: '', //七牛上传token
        districtList:[]
	},
	
	mutations: {
		update_permisison_list(state, payload) {
			state.permissionList = payload
		},
		update_operation_list(state, payload) {
			state.operationList = payload
		},
		[SET_BUCKET_DOMAIN](state, payload) {
			state.imgDomain = payload;
		},
		
		[SET_BUCKET_DOMAIN_TOKEN](state, payload) {
			state.bucket_domain_token = payload;
		},
        
        [SET_DISTRICT_LIST](state, payload) {
        	state.districtList = payload;
        },
	},
	actions,
	plugins: [createPersiste()]
})

export default store;
